# Copyright 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.


"""Looks up Short Video Descriptor specs, listed in Video Data Block."""

_svds = [
    'No Video Identification Code Available (Used with AVI InfoFrame only)',
    '640x480p              59.94Hz/60Hz  4:3     1:1',
    '720x480p              59.94Hz/60Hz  4:3     8:9',
    '720x480p              59.94Hz/60Hz  16:9    32:27',
    '1280x720p             59.94Hz/60Hz  16:9    1:1',
    '1920x1080i            59.94Hz/60Hz  16:9    1:1',
    '720(1440)x480i        59.94Hz/60Hz  4:3     8:9',
    '720(1440)x480i        59.94Hz/60Hz  16:9    32:27',
    '720(1440)x240p        59.94Hz/60Hz  4:3     4:9',
    '720(1440)x240p        59.94Hz/60Hz  16:9    16:27',
    '2880x480i             59.94Hz/60Hz  4:3     2:9-20:9',
    '2880x480i             59.94Hz/60Hz  16:9    8:27-80:27',
    '2880x240p             59.94Hz/60Hz  4:3     1:9-10:9',
    '2880x240p             59.94Hz/60Hz  16:9    4:27-40:27',
    '1440x480p             59.94Hz/60Hz  4:3     4:9 or 8:9',
    '1440x480p             59.94Hz/60Hz  16:9    16:27 or 32:27',
    '1920x1080p            59.94Hz/60Hz  16:9    1:1',
    '720x576p              50Hz          4:3     16:15',
    '720x576p              50Hz          16:9    64:45',
    '1280x720p             50Hz          16:9    1:1',
    '1920x1080i            50Hz          16:9    1:1',
    '720(1440)x576i        50Hz          4:3     16:15',
    '720(1440)x576i        50Hz          16:9    64:45',
    '720(1440)x288p        50Hz          4:3     8:15',
    '720(1440)x288p        50Hz          16:9    32:45',
    '2880x576i             50Hz          4:3     2:15-20:15',
    '2880x576i             50Hz          16:9    16:45-160:45',
    '2880x288p             50Hz          4:3     1:15-10:15',
    '2880x288p             50Hz          16:9    8:45-80:45',
    '1440x576p             50Hz          4:3     8:15 or 16:15',
    '1440x576p             50Hz          16:9    32:45 or 64:45',
    '1920x1080p            50Hz          16:9    1:1',
    '1920x1080p            23.98Hz/24Hz  16:9    1:1',
    '1920x1080p            25Hz          16:9    1:1',
    '1920x1080p            29.97Hz/30Hz  16:9    1:1',
    '2880x480p             59.94Hz/60Hz  4:3     2:9, 4:9, or 8:9',
    '2880x480p             59.94Hz/60Hz  16:9    8:27, 16:27, or 32:27',
    '2880x576p             50Hz          4:3     4:15, 8:15, or 16:15',
    '2880x576p             50Hz          16:9    16:45, 32:45, or 64:45',
    '1920x1080i(1250total) 50Hz          16:9    1:1',
    '1920x1080i            100Hz         16:9    1:1',
    '1280x720p             100Hz         16:9    1:1',
    '720x576p              100Hz         4:3     16:15',
    '720x576p              100Hz         16:9    64:45',
    '720(1440)x576i        100Hz         4:3     16:15',
    '720(1440)x576i        100Hz         16:9    64:45',
    '1920x1080i            119.88/120Hz  16:9    1:1',
    '1280x720p             119.88/120Hz  16:9    1:1',
    '720x480p              119.88/120Hz  4:3     8:9',
    '720x480p              119.88/120Hz  16:9    32:27',
    '720(1440)x480i        119.88/120Hz  4:3     8:9',
    '720(1440)x480i        119.88/120Hz  16:9    32:27',
    '720x576p              200Hz         4:3     16:15',
    '720x576p              200Hz         16:9    64:45',
    '720(1440)x576i        200Hz         4:3     16:15',
    '720(1440)x576i        200Hz         16:9    64:45',
    '720x480p              239.76/240Hz  4:3     8:9',
    '720x480p              239.76/240Hz  16:9    32:27',
    '720(1440)x480i        239.76/240Hz  4:3     8:9',
    '720(1440)x480i        239.76/240Hz  16:9    32:27',
    '1280x720p             23.98Hz/24Hz  16:9    1:1',
    '1280x720p             25Hz          16:9    1:1',
    '1280x720p             29.97Hz/30Hz  16:9    1:1',
    '1920x1080p            119.88/120Hz  16:9    1:1',
    '1920x1080p            100Hz         16:9    1:1',
    '1280x720p             23.98Hz/24Hz  64:27   4:3',
    '1280x720p             25Hz          64:27   4:3',
    '1280x720p             29.97Hz/30Hz  64:27   4:3',
    '1280x720p             50Hz          64:27   4:3',
    '1280x720p             59.94Hz/60Hz  64:27   4:3',
    '1280x720p             100Hz         64:27   4:3',
    '1280x720p             119.88/120Hz  64:27   4:3',
    '1920x1080p            23.98Hz/24Hz  64:27   4:3',
    '1920x1080p            25Hz          64:27   4:3',
    '1920x1080p            29.97Hz/30Hz  64:27   4:3',
    '1920x1080p            50Hz          64:27   4:3',
    '1920x1080p            59.94Hz/60Hz  64:27   4:3',
    '1920x1080p            100Hz         64:27   4:3',
    '1920x1080p            119.88/120Hz  64:27   4:3',
    '1680x720p             23.98Hz/24Hz  64:27   64:63',
    '1680x720p             25Hz          64:27   64:63',
    '1680x720p             29.97Hz/30Hz  64:27   64:63',
    '1680x720p             50Hz          64:27   64:63',
    '1680x720p             59.94Hz/60Hz  64:27   64:63',
    '1680x720p             100Hz         64:27   64:63',
    '1680x720p             119.88/120Hz  64:27   64:63',
    '2560x1080p            23.98Hz/24Hz  64:27   1:1',
    '2560x1080p            25Hz          64:27   1:1',
    '2560x1080p            29.97Hz/30Hz  64:27   1:1',
    '2560x1080p            50Hz          64:27   1:1',
    '2560x1080p            59.94Hz/60Hz  64:27   1:1',
    '2560x1080p            100Hz         64:27   1:1',
    '2560x1080p            119.88/120Hz  64:27   1:1',
    '3840x2160p            23.98Hz/24Hz  16:9    1:1',
    '3840x2160p            25Hz          16:9    1:1',
    '3840x2160p            29.97Hz/30Hz  16:9    1:1',
    '3840x2160p            50Hz          16:9    1:1',
    '3840x2160p            59.94Hz/60Hz  16:9    1:1',
    '4096x2160p            23.98Hz/24Hz  256:135 1:1',
    '4096x2160p            25Hz          256:135 1:1',
    '4096x2160p            29.97Hz/30Hz  256:135 1:1',
    '4096x2160p            50Hz          256:135 1:1',
    '4096x2160p            59.94Hz/60Hz  256:135 1:1',
    '3840x2160p            23.98Hz/24Hz  64:27   4:3',
    '3840x2160p            25Hz          64:27   4:3',
    '3840x2160p            29.97Hz/30Hz  64:27   4:3',
    '3840x2160p            50Hz          64:27   4:3',
    '3840x2160p            59.94Hz/60Hz  64:27   4:3'
]


def GetSvd(code):
  """Fetches the Short Video Descriptor for a given numerical code.

  Args:
    code: An integer indicating the short video descriptor.

  Returns:
    A string representing the Short Video Descriptor.
  """
  if code < len(_svds):
    return _svds[code]
  else:
    return 'Reserved for Future'


